var huizongbiao = new Vue({
    el : '#Huizongbiaolist',
    data:{
        xiangmuId : $("#xiangmuId").val(),
        xiangmu : {},
        HuizongbiaoList : [],
        show : false,
        total:0,

    },
    created : function() {
        var _this = this;
        $(".nav navbar-nav li").removeClass("active");
        $("#nav_huizongbiao").addClass("active");
        _this.findIsacticed();
        _this.bindHuizongbiaoList();


    },
    methods : {

        findIsacticed:function (){
            var _this = this;
            layer.open({type:3});
            $.post('/xiangmu/find_one', {
                xianmguid:_this.xiangmuId,
                rdm : Math.random()
            },function(ppData) {
                layer.closeAll("loading");
                if(ppData != null){
                    if(ppData.result == "1"){
                        var data = ppData.resultContent;
                        _this.xiangmu = data;
                        _this.bindHuizongbiaoList();

                    }else{
                        layer.alert(ppData.message);
                    }
                }
            },"json");
        },

        bindHuizongbiaoList:function (){
            var _this = this;
            layer.open({type:3});
            $.post("/yiyongjieguo/findHuizongbiaolist",{
                xiangmuid : _this.xiangmuId,

                rdm : Math.random()
            },function(ppData){
                layer.closeAll("loading");
                if (ppData != null){
                    if(ppData.result == "1"){
                        var data=ppData.resultContent;
                        var mmHtml = "<div class='table-head'><table class=\"table table-hover table-bordered\" style=\"overflow:hidden; margin-bottom:10px;table-layout:fixed;\" v-if=\"show\" cellspacing=\"0\" cellpadding=\"0\">\n" +
                            "   <thead >\n" +
                            "    <tr style=\"font-weight: bold;\">\n" +
                            /*"       <td style=\"text-align:center;vertical-align:middle;width:60px;\" >排名</td>\n" +*/
                            "       <td style=\"text-align:center;vertical-align:middle;width:60px;\" >序号</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:60px;\" >品种名</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:80px;\" >品种序号</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:80px;\" >品牌序号</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:80px;\" >型号序号</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >平台编码</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >产品名称</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >产品规格</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >产品型号</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >注册证号</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >生产商（品牌）</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:60px;\" >计价单位</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:80px;\" >平台情况</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:80px;\" >进口/国产</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:80px;\" >平台单价（元）</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >是否医保</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >备注</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:100px;\" >委员表决票数</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;\">表决结果</td>\n" +
                            "    </tr>\n" +


                            "   </thead></table></div><div class='table-body'><table style=\"table-layout: fixed;\"><tbody>";
                        if(data.HuizongbiaoList.length > 0){
                            _this.show = true;
                            _this.huizongbiaolist=data.HuizongbiaoList;


                            for (var i = 0; i < data.HuizongbiaoList.length; i++) {
                                var mmHuizongbiao = data.HuizongbiaoList[i];
                                var mmPinzhong = mmHuizongbiao.pinzhongxuhao;
                                var mmPinzhongming = mmHuizongbiao.pinzhongming;
                                var mmPinpaiList = mmHuizongbiao.pinguilist;
                                    var mmPinzhongHebingshu = mmHuizongbiao.pinzhonghebinghang;


                                for (var j = 0; j < mmPinpaiList.length; j++) {
                                    var s=0;

                                    var mmPinpailist = mmPinpaiList[j];
                                    var mmPinpai = mmPinpailist.pinpaixuhao;
                                    var mmPinpaiHebingshu = mmPinpailist.pinpaihebinghang;
                                    var mmXinghaolist= mmPinpailist.xinghaolist;
                                    var mmPinpaiHebingshu = mmPinpailist.pinpaihebinghang;
                                    var mmPinpaipaoshu = mmPinpailist.pinguitext;
                                    var mmJieguo = mmPinpailist.jieguotext;

                                    var mmPinpaiHebinghang = "";
                                    if (mmPinpaiHebingshu > 1) {
                                        mmPinpaiHebinghang = "rowspan='" + mmPinpaiHebingshu + "'";
                                    } else {
                                        mmPinpaiHebinghang = "";
                                    }


                                    for (var k = 0; k < mmXinghaolist.length; k++) {
                                        var mmxinghaolist = mmXinghaolist[k];
                                        var mmOrdernumber = mmxinghaolist.ordernumber;
                                        var mmXinghaocaifen = mmxinghaolist.xinghaoxuhao;
                                        var mmPingtaibianma = mmxinghaolist.pingtaibianma;
                                        var mmZhucezhengmingcheng = mmxinghaolist.zhucezhengmingcheng;
                                        var mmchanpinmingcheng = mmxinghaolist.chanpinmingcheng;
                                        var mmGuige = mmxinghaolist.chanpinguige;
                                        var mmXinghao = mmxinghaolist.chanpinxinghao;
                                        var mmzhucezhenghao = mmxinghaolist.zhucezhenghao;
                                        var mmshengchanshang = mmxinghaolist.shengchanshangpinpai;
                                        var mmjijiadanwei = mmxinghaolist.jijiadanwei;
                                        var mmpingtaiqingkuang = mmxinghaolist.pingtaiqingkuang;
                                        var mmjinkouguochan = mmxinghaolist.jinkouguochan;
                                        var mmPingtaidanjia = mmxinghaolist.pingtaidanjia;
                                        var mmgongnengyongtu = mmxinghaolist.gongnengyongtu;
                                        var mmshifouyibao = mmxinghaolist.text10;
                                        var mmbeizhu = mmxinghaolist.text11;
                                        var mmHuanhangfu = "";

                                        var mmyijihe="";
                                        var mmerjihe="";
                                        var mmerjihe2="";
                                        var mmyijihe2="";
                                        var mmpaixun=i+1;

                                        if(mmPinzhong%2==0){//品种偶数行有颜色
                                            mmHuanhangfu +="<tr style='background-color: #f2f2f2'>"
                                        }else {
                                            mmHuanhangfu +="<tr>"
                                        }
                                        if(mmPinzhong%2==0){//品种偶数行
                                            if (k != 0) {//型号不是第一行
                                                mmHuanhangfu = "<tr style='background-color: #f2f2f2'>";
                                            }else{//型号第一行
                                                mmerjihe="<td style='text-align:center;vertical-align:middle;width: 80px;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpai + "</td>";
                                                mmerjihe2="<td style='text-align:center;vertical-align:middle;width: 100px;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpaipaoshu + "</td>";
                                                if(mmJieguo=='通过'){
                                                    mmerjihe2+="<td style='text-align:center;vertical-align:middle;color: green;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmJieguo + "</td>";

                                                }else {
                                                    mmerjihe2+="<td style='text-align:center;vertical-align:middle;color: red;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmJieguo + "</td>";
                                                }
                                            }
                                        }else {//品种奇数行
                                            if (k != 0) {
                                                mmHuanhangfu = "<tr>";
                                            }else{
                                                mmerjihe="<td style='text-align:center;vertical-align:middle;width: 80px;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpai + "</td>";
                                                mmerjihe2="<td style='text-align:center;vertical-align:middle;width: 100px;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpaipaoshu + "</td>";
                                                if(mmJieguo=='通过'){
                                                    mmerjihe2+="<td style='text-align:center;vertical-align:middle;color: green;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmJieguo + "</td>";

                                                }else {
                                                    mmerjihe2+="<td style='text-align:center;vertical-align:middle;color: red;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmJieguo + "</td>";
                                                }
                                            }
                                        }
                                       /* if (k != 0) {
                                            mmHuanhangfu = "<tr>";
                                        }else{
                                            mmerjihe="<td style='text-align:center;vertical-align:middle;width: 80px;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpai + "</td>";
                                            mmerjihe2="<td style='text-align:center;vertical-align:middle;width: 100px;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpaipaoshu + "</td>";
                                            if(mmJieguo=='通过'){
                                                mmerjihe2+="<td style='text-align:center;vertical-align:middle;color: green;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmJieguo + "</td>";

                                            }else {
                                                mmerjihe2+="<td style='text-align:center;vertical-align:middle;color: red;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmJieguo + "</td>";
                                            }
                                        }*/
                                        if(j==0 &&s==0){
                                            /*mmyijihe2= "<td style='text-align:center;vertical-align:middle;width: 60px;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'>" + mmpaixun + "</td>";*/
                                            mmyijihe= "<td style='text-align:center;vertical-align:middle;width: 60px;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'>" + mmPinzhongming + "</td>";
                                            mmyijihe+= "<td style='text-align:center;vertical-align:middle;width: 80px;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'>" + mmPinzhong + "</td>";
                                            s= 1;
                                        }

                                        mmHtml += mmHuanhangfu;
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:60px;'>" + mmOrdernumber + "</td>";

                                        mmHtml +=mmyijihe;

                                        mmHtml+=mmerjihe;

                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;'>" + mmXinghaocaifen + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmPingtaibianma + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmchanpinmingcheng + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a title='" + mmGuige + "'>" + mmGuige + "</a></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a title='" + mmXinghao + "'>" + mmXinghao + "</a></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmzhucezhenghao + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmshengchanshang + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:60px;'>" + mmjijiadanwei + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;'>" + mmpingtaiqingkuang + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;'>" + mmjinkouguochan + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;'>" + mmPingtaidanjia + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmshifouyibao + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmbeizhu + "</td>";
                                       /* mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a title='" + mmgongnengyongtu + "'>" + mmgongnengyongtu + "</a></td>";*/
                                        mmHtml+=mmerjihe2;

                                        mmHtml += "</tr>";
                                    }
                                }
                            }

                        }else {
                            _this.show = false;
                        }
                        mmHtml += "</table>";
                        $("#List").html(mmHtml);
                    }else{
                        layer.alert(ppData.message);
                    }
                }

            },"json");
        },



    },
    watch :{
        //监控分页情况，刷新列表
        pageIndex : function(){

            this.bindHuizongbiaoList();
        }
    }
})